\(\int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx\) [619]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 30, antiderivative size = 16 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=a x-\frac {b \sin (c+d x)}{d} \]

[Out]

a*x-b*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3095, 2717} \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=a x-\frac {b \sin (c+d x)}{d} \]

[In]

Int[(a^2 - b^2*Cos[c + d*x]^2)/(a + b*Cos[c + d*x]),x]

[Out]

a*x - (b*Sin[c + d*x])/d

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3095

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
C/b^2, Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[-a + b*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, C, m}, x
] && EqQ[A*b^2 + a^2*C, 0]

Rubi steps \begin{align*} \text {integral}& = -\int (-a+b \cos (c+d x)) \, dx \\ & = a x-b \int \cos (c+d x) \, dx \\ & = a x-\frac {b \sin (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.75 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=a x-\frac {b \cos (d x) \sin (c)}{d}-\frac {b \cos (c) \sin (d x)}{d} \]

[In]

Integrate[(a^2 - b^2*Cos[c + d*x]^2)/(a + b*Cos[c + d*x]),x]

[Out]

a*x - (b*Cos[d*x]*Sin[c])/d - (b*Cos[c]*Sin[d*x])/d

Maple [A] (verified)

Time = 1.51 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06

method result size
risch \(a x -\frac {b \sin \left (d x +c \right )}{d}\) \(17\)
parallelrisch \(\frac {a x d -b \sin \left (d x +c \right )}{d}\) \(19\)
derivativedivides \(\frac {-b \sin \left (d x +c \right )+a \left (d x +c \right )}{d}\) \(22\)
default \(\frac {-b \sin \left (d x +c \right )+a \left (d x +c \right )}{d}\) \(22\)
norman \(\frac {a x +a x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 a x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(82\)

[In]

int((-b^2*cos(d*x+c)^2+a^2)/(a+cos(d*x+c)*b),x,method=_RETURNVERBOSE)

[Out]

a*x-b*sin(d*x+c)/d

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.12 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {a d x - b \sin \left (d x + c\right )}{d} \]

[In]

integrate((a^2-b^2*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="fricas")

[Out]

(a*d*x - b*sin(d*x + c))/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (12) = 24\).

Time = 0.32 (sec) , antiderivative size = 32, normalized size of antiderivative = 2.00 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\begin {cases} a x - \frac {b \sin {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\\frac {x \left (a^{2} - b^{2} \cos ^{2}{\left (c \right )}\right )}{a + b \cos {\left (c \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate((a**2-b**2*cos(d*x+c)**2)/(a+b*cos(d*x+c)),x)

[Out]

Piecewise((a*x - b*sin(c + d*x)/d, Ne(d, 0)), (x*(a**2 - b**2*cos(c)**2)/(a + b*cos(c)), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((a^2-b^2*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (16) = 32\).

Time = 0.30 (sec) , antiderivative size = 39, normalized size of antiderivative = 2.44 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {{\left (d x + c\right )} a - \frac {2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1}}{d} \]

[In]

integrate((a^2-b^2*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="giac")

[Out]

((d*x + c)*a - 2*b*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 1.81 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.19 \[ \int \frac {a^2-b^2 \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=-\frac {b\,\sin \left (c+d\,x\right )-a\,d\,x}{d} \]

[In]

int((a^2 - b^2*cos(c + d*x)^2)/(a + b*cos(c + d*x)),x)

[Out]

-(b*sin(c + d*x) - a*d*x)/d